<link rel="stylesheet" href="<%- Virtual_Path.Static %>main/css/report.css"/>
<!-- start report -->
<div class="VReport-Out">
    <div class="VReport-In">
        <div class="VReport-Box">
            <div class="VR-title divColorbox_Header">
                <h2>用户举报</h2>
                <a class="closed Close" href="javascript:;" data-rel="tooltip" data-original-title="关闭" data-placement="bottom"></a>
            </div>
            <div class="VR-content">
                <div class="VR-control">
                    <div class="VR-col-l">
                        举报艺人 :
                    </div>
                    <div class="VR-col-r" id="J_Anchor_NickName">
                    </div>
                </div>
                <div class="VR-control">
                    <div class="VR-col-l">
                        举报类型 :
                    </div>
                    <div class="VR-col-r" id="J_Anchor_ReportType">
                        <span class="icheckbox">色情信息</span>
                        <span class="icheckbox">垃圾广告</span>
                        <span class="icheckbox">人身攻击</span>
                        <span class="icheckbox">敏感信息</span>
                        <span class="icheckbox">虚假中奖信息</span>
                    </div>
                </div>
                <div class="VR-control">
                    <div class="VR-col-l">
                        违规图片 :
                    </div>
                    <div class="VR-col-r">
                        <div class="VR-upload" id="J_VR_upload_1">
                            <span class="VR-upload-img" id="J_VR_Upload_img1"></span>
                        </div>
                        <div class="VR-upload" id="J_VR_upload_2">
                            <span class="VR-upload-img" id="J_VR_Upload_img2"></span>
                        </div>
                        <div class="VR-upload" id="J_VR_upload_3">
                            <span class="VR-upload-img" id="J_VR_Upload_img3"></span>
                        </div>
                    </div>
                </div>
                <div class="VR-control">
                    <div class="VR-col-l">
                        举报理由 :
                    </div>
                    <div class="VR-col-r">
                        <textarea name="" class="VR-TextArea" placeholder="例如艺人穿着暴露..." id="J_Anchor_ReportInfo"></textarea>
                    </div>
                </div>
                <div class="VR-control VR-Button">
                    <button class="VR-Btn" id="J_VR_Submit">提 交</button>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- end report -->

<script src="<%- Virtual_Path.Static %>jquery.plugin/uploadifive/jquery.uploadifive.min.js"></script>
<link rel="stylesheet" href="<%- Virtual_Path.Static %>jquery.plugin/uploadifive/uploadifive.css">
<link rel="stylesheet" href="<%- Virtual_Path.Static %>jquery.plugin/uploadifive/uploadifive.custom.css">
<script>
    $(function () {
        var _ReportInfo = {
            User_ID: _PageData.UserInfo.User_ID,
            Content: null,
            Screenshot: null,
            Type: null
        };
        $("#J_Anchor_NickName").html(_PageData.UserInfo.NickName);
        ////////////////////////////////////
        //举报照片
        ////////////////////////////////////
        $('#J_VR_Upload_img1').uploadifive({
            'uploadScript': _VirtualPath.Utils + 'service/fileupload',
            'removeCompleted': true,
            'multi': false,
            'buttonClass': 'uploadfile',
            'buttonText': '违规照片',
            'fileType': 'image/*',
            'width': "62",
            'height': "62",
            'onUploadComplete': function (file, data) {
                data = $.parseJSON(data);
                if (data.flag !== 0) {
                    $.CommonMain.Modal_Tip("上传文件出错，请重试！", {Timeout: 1000});
                    return;
                }
                $.ajax({
                    url: "/ajax/base.user-reportimg",
                    type: "post",
                    dataType: "json",
                    data: {
                        FileName: data.FileName,
                        Front: "a"
                    },
                    success: function (data) {
                        var _html = '<img src="' + _VirtualPath.Utils_CDN + "service/img/report/" + _StateData.User_ID + "/" + data.path + '.jpg" data-path="' + data.path + '" alt="" class="VR-img">' +
                                '<span class="VR-del"><i class="ico-del"></i></span>'
                        $('#J_VR_Upload_img1').parent().before(_html);
                        var _Screenshot = data.path + ".png";
                    }
                });
            }
        });

        $('#J_VR_Upload_img2').uploadifive({
            'uploadScript': _VirtualPath.Utils + 'service/fileupload',
            'removeCompleted': true,
            'multi': false,
            'buttonClass': 'uploadfile',
            'buttonText': '违规照片',
            'fileType': 'image/*',
            'width': "62",
            'height': "62",
            'onUploadComplete': function (file, data) {
                data = $.parseJSON(data);
                if (data.flag !== 0) {
                    $.CommonMain.Modal_Tip("上传文件出错，请重试！", {Timeout: 1000});
                    return;
                }
                $.ajax({
                    url: "/ajax/base.user-reportimg",
                    type: "post",
                    dataType: "json",
                    data: {
                        FileName: data.FileName,
                        Front: "a"
                    },
                    success: function (data) {
                        var _html = '<img src="' + _VirtualPath.Utils_CDN + "service/img/report/" + _StateData.User_ID + "/" + data.path + '.jpg" data-path="' + data.path + '" alt="" class="VR-img">' +
                                '<span class="VR-del"><i class="ico-del"></i></span>'
                        $('#J_VR_Upload_img2').parent().before(_html);
                    }
                });
            }
        });

        $('#J_VR_Upload_img3').uploadifive({
            'uploadScript': _VirtualPath.Utils + 'service/fileupload',
            'removeCompleted': true,
            'multi': false,
            'buttonClass': 'uploadfile',
            'buttonText': '违规照片',
            'fileType': 'image/*',
            'width': "62",
            'height': "62",
            'onUploadComplete': function (file, data) {
                data = $.parseJSON(data);
                if (data.flag !== 0) {
                    $.CommonMain.Modal_Tip("上传文件出错，请重试！", {Timeout: 1000});
                    return;
                }
                $.ajax({
                    url: "/ajax/base.user-reportimg",
                    type: "post",
                    dataType: "json",
                    data: {
                        FileName: data.FileName,
                        Front: "a"
                    },
                    success: function (data) {
                        var _html = '<img src="' + _VirtualPath.Utils_CDN + "service/img/report/" + _StateData.User_ID + "/" + data.path + '.jpg" data-path="' + data.path + '" alt="" class="VR-img">' +
                                '<span class="VR-del"><i class="ico-del"></i></span>'
                        $('#J_VR_Upload_img3').parent().before(_html);
                    }
                });
            }
        });

        $("#J_Anchor_ReportType").on("click", ".icheckbox", function () {
            _ReportInfo.Type = $(this).text();
            $(this).addClass("icheckboxactive").siblings().removeClass("icheckboxactive");
        })
        $(".VR-upload").on("click", ".VR-del", function () {
            _ReportInfo.Screenshot = null;
            $(this).siblings('.VR-img').remove().end().remove();
        });

        $("#J_VR_Submit").on("click", function () {
            _ReportInfo.Content = $("#J_Anchor_ReportInfo").val();
            var img1 = $("#J_VR_upload_1 img.VR-img").data("path");
            var img2 = $("#J_VR_upload_2 img.VR-img").data("path");
            var img3 = $("#J_VR_upload_3 img.VR-img").data("path");
            if (img1 != null) {
                _ReportInfo.Screenshot = img1;
            }
            if (img2 != null) {
                _ReportInfo.Screenshot = _ReportInfo.Screenshot + ',' + img2;
            }
            if (img3 != null) {
                _ReportInfo.Screenshot = _ReportInfo.Screenshot + ',' + img3;
            }
            if (_ReportInfo.Type == null) {
                $.CommonMain.Modal_Tip('请选择举报类型！', {
                    Timeout: 1000
                });
                return;
            }
            if (_ReportInfo.Screenshot == null) {
                $.CommonMain.Modal_Tip('请上传举报照片！', {
                    Timeout: 1000
                });
                return;
            }

            $.CommonMain.User_Report(_ReportInfo.Content, _ReportInfo.Type, _ReportInfo.User_ID, _ReportInfo.Screenshot, function () {
                $.CommonMain.Modal_Tip('举报成功', {
                    Title: "提示",
                    Timeout: 1000,
                    onClose: function () {
                        $.Common.ModalWindow.fnEnter();
                    }
                });
            });
        });
    });

</script>